refactor: simplify CLI and Session API by removing generic type parameters#137
Merged
branchseer merged 10 commits intomainfrom Feb 8, 2026
Merged
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
d6ec191 to
3b2ec03
Compare
…eters Remove generic CustomSubcommand type parameter from Session, SessionCallbacks, PlanRequestParser, and TaskSynthesizer. The CLI only supports `run` as a top-level subcommand; synthetic tasks (lint, test, env-test) are now handled purely by TaskSynthesizer via string matching on program name and args. Key changes: - TaskSynthesizer trait takes (program, args) directly instead of a typed subcommand - Session/SessionCallbacks/PlanRequestParser no longer parameterized by subcommand type - plan_from_cli accepts BuiltInCommand directly (removed CLIArgs, TaskCLIArgs, ParsedTaskCLIArgs) - Binary crate owns its top-level Cli parser wrapping BuiltInCommand - E2E test fixtures converted from `vite lint`/`vite env-test` to `vite run <task>` - Removed same-name-as-builtin fixture (tested now-removed CLI lint vs run distinction) - Added diagnostic block sorting in E2E output redaction for deterministic snapshots Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4c064b8 to
d4407b3
Compare
3b2ec03 to
8830f7d
Compare
8830f7d to
5207ad4
Compare
…eters Remove generic CustomSubcommand type parameter from Session, SessionCallbacks, PlanRequestParser, and TaskSynthesizer. The CLI only supports `run` as a top-level subcommand; synthetic tasks (lint, test, env-test) are now handled purely by TaskSynthesizer via string matching on program name and args. Key changes: - TaskSynthesizer trait takes (program, args) directly instead of a typed subcommand - Session/SessionCallbacks/PlanRequestParser no longer parameterized by subcommand type - plan_from_cli accepts BuiltInCommand directly (removed CLIArgs, TaskCLIArgs, ParsedTaskCLIArgs) - Binary crate owns its top-level Cli parser wrapping BuiltInCommand - E2E test fixtures converted from `vite lint`/`vite env-test` to `vite run <task>` - Removed same-name-as-builtin fixture (tested now-removed CLI lint vs run distinction) - Added diagnostic block sorting in E2E output redaction for deterministic snapshots Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Group program/args/envs/cwd into a ScriptCommand struct passed by &mut
to both CommandHandler::handle_command and PlanRequestParser::get_plan_request.
Handlers can now mutate command fields in-place (e.g., rewriting vpr → vite run)
or return a Synthesized plan request. Replace old ViteTaskCommand variant with
NotSynthesized { is_vite_task_entry } and use clap's has_subcommand() for
subcommand detection.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove ExecutionCacheKeyKind and make ExecutionCacheKey a flat enum with UserTask and Exec variants. The Exec variant derives its cache key from actual execution content (program name, args, cwd) instead of requiring callers to provide an opaque direct_execution_cache_key. This also removes the direct_execution_cache_key field from SyntheticPlanRequest and renames Session::plan_synthetic_task to Session::plan_exec. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace `ExecutionCacheKey::Exec { program_name, args, cwd }` with
`ExecAPI(Arc<[Str]>)`, an opaque caller-provided cache key. Add
`cache_key` parameter to `Session::plan_exec` and new
`ExecutionPlan::plan_exec` entry point. Bump cache DB version to 6.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace HandledCommand::NotSynthesized { is_vite_task_entry } with
explicit Verbatim and ViteTaskCommand(Command) variants. All vite
subcommand parsing (lint, test, env-test, run) now happens via a
clap-derived Args enum in vite_task_bin, simplifying PlanRequestParser
to a trivial dispatcher.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract RunCommand struct from Command::Run, add CacheSubcommand::Clean to Command, and introduce Session::main() as the primary CLI entry point. This makes reporter types and execute() internal, simplifying the public API. When `vite cache clean` appears in a script, PlanRequestParser generates a synthesized task with caching disabled. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Session::exec for executing synthetic commands with cache support independently of Session::main. In vite-plus, this pattern is used for auto-install. Also expose Args enum and find_executable from vite_task_bin, remove the Cli wrapper in main.rs, and add e2e tests validating exec caching behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Remove generic CustomSubcommand type parameter from Session, SessionCallbacks,
PlanRequestParser, and TaskSynthesizer. The CLI only supports
runas atop-level subcommand; synthetic tasks (lint, test, env-test) are now handled
purely by TaskSynthesizer via string matching on program name and args.
Key changes:
vite lint/vite env-testtovite run <task>Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com